# 这里主要是介绍一下python中类的定义，函数的定义和使用
def user_info(name, age, address="beijing"):
    print("my name is {}, my age is {}, my address is {}".format(name, age, address))

# 没有返回值则返回None，对于参数可以设置默认值，如果没有指定默认值同时又没有传递该参数，则会抛出异常
user_info("hanyy", 30)

# 所有传递的参数都会被收集合并为一个元组，args是元组类型
def user_info2(*args):
    print(args)

# 结果：('lishi',)
user_info2("lishi")
# 结果：('wangwu', 10)
user_info2("wangwu", 10)

# 当然也可以将参数包装成字典
def user_info3(**args):
    print(args)

# 结果：{'name': 'lishi', 'age': 10}
user_info3(name = "lishi", age = 10)



class Student(object):
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def run(self, age):
        print("A---" + self.name)


class Xm(Student):
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def run(self):
        print("B---" + self.name)

student = Xm("xiaoming", 15)

student.run(18)

